package com.oceansoft.core.jxkh.controller;

import com.oceansoft.core.common.constant.Constant;
import com.oceansoft.core.common.util.Pagination;
import com.oceansoft.core.domain.SysUser;
import com.oceansoft.core.jxkh.domain.WorkLog;
import com.oceansoft.core.jxkh.service.IWorkLogService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by 陈赛 on 2017-11-01.
 */
@Controller
@RequestMapping("/jump")
public class JumpController {
    @Resource
    private IWorkLogService workLogService;
    @RequestMapping(value="khcp_zp.html")
    public String index(HttpServletRequest request, ModelMap model) {
        SysUser user = (SysUser) request.getSession().getAttribute(Constant.LOGIN_USER);
        Map<String,Object> roles =  (Map<String,Object>) request.getSession().getAttribute(
                Constant.SESSION_ROLOES);
        String type="0";
        if(roles.containsKey("2")){
            type="0";
        } else
        if(roles.containsKey("10")){//指挥长 统计部门的数据
            type="1";
        }
        else
        if(roles.containsKey("11")){//指挥长 统计部门的数据
            type="1";
        }else
        if(roles.containsKey("12")){//处级干部 统计部门的数据
            type="0";
        }

        //根据type获取上周，上月，上季度工作情况
        List<Map<String,Object>> list = new ArrayList<Map<String,Object>>();
        list = workLogService.findMonthWork(user.getPoliceNum());
        String content = "";
        if(list.size()>0){
            for(int i =0;i<list.size();i++){
                content+="日常工作:"+list.get(i).get("CONTENT1")+";";
                content+="重点工作:"+list.get(i).get("CONTENT2")+";";
                content+="交办工作:"+list.get(i).get("CONTENT3")+";";
            }
        }
        model.addAttribute("content",content);
        model.addAttribute("type",type);
        return "jump/khcp_zp";
    }




    @RequestMapping(value="wdgz_rz.html")
    public String wdgz_rz(HttpServletRequest request, ModelMap model) {
        return "jump/wdgz_rz";
    }

    @RequestMapping(value="index1.html")
    public String index1(HttpServletRequest request, ModelMap model) {
        return "jump/index1";
    }

    /**
     * 菜单链接
     */
    /*
    * 部门管理
    * */
    @RequestMapping(value="bmgl.html")
    public String bmgl(HttpServletRequest request, ModelMap model) {
        return "jump/bmgl";
    }
    /*
   * 人员管理
   * */
    @RequestMapping(value="rygl.html")
    public String rygl(HttpServletRequest request, ModelMap model) {
        return "jump/rygl";
    }
    /*
     * 分值汇总设置
     * */
    @RequestMapping(value="fzhzsz.html")
    public String fzhzsz(HttpServletRequest request, ModelMap model) {
        return "jump/fzhzsz";
    }
    /*
    * 考核配置管理
    * */
    @RequestMapping(value="khfzpz.html")
    public String khfzpz(HttpServletRequest request, ModelMap model) {
        return "jump/khfzpz";
    }

    /*
    * 考核任务管理
    * */
    @RequestMapping(value="khrwgl.html")
    public String khrwgl(HttpServletRequest request, ModelMap model) {
        return "task/khrwgl";
    }

    /*
    * 考核任务查看
    * */
    @RequestMapping(value="khrwck.html")
    public String khrwck(HttpServletRequest request, ModelMap model) {
        return "task/khrwck";
    }
    /*
   * 考核结果查看
   * */
    @RequestMapping(value="khjg.html")
    public String khjg(HttpServletRequest request, ModelMap model) {
        return "jump/khjg";
    }
    /*
     * 角色配置
    * */
    @RequestMapping(value="jspz.html")
    public String jspz(HttpServletRequest request, ModelMap model) {
        return "jump/jspz";
    }


    /*
    * 考核域设置
   * */
    @RequestMapping(value="khysz.html")
    public String khysz(HttpServletRequest request, ModelMap model) {
        return "jump/khysz";
    }

    /*
      * 年度考核统计
     * */
    @RequestMapping(value="ndkhtj.html")
    public String ndkhtj(HttpServletRequest request, ModelMap model) {
        return "jump/ndkhtj";
    }

    /*
         * 资源管理
        * */
    @RequestMapping(value="zygl.html")
    public String zygl(HttpServletRequest request, ModelMap model) {
        return "jump/zygl";
    }

     /*
         * 资源管理
        * */
    @RequestMapping(value="mjsjdj.html")
    public String mjsjdj(HttpServletRequest request, ModelMap model) {
        return "jump/mjsjdj";
    }
    /*
       * 资源管理
      * */
    @RequestMapping(value="czrz.html")
    public String czrz(HttpServletRequest request, ModelMap model) {
        return "jump/czrz";
    }

    /*
       * 资源管理
      * */
    @RequestMapping(value="dlrz.html")
    public String dlrz(HttpServletRequest request, ModelMap model) {
        return "jump/dlrz";
    }

    /*
     * 半年测评
    * */
    @RequestMapping(value="bncp.html")
    public String bncp(HttpServletRequest request, ModelMap model) {
        return "jump/bncp";
    }

    /*
    * 半年测评
   * */
    @RequestMapping(value="khrygxsz.html")
    public String khrygxsz(HttpServletRequest request, ModelMap model) {
        return "jump/khrygxsz";
    }

    /*
      * 个人年度成绩走势
     * */
    @RequestMapping(value="grndcjzs.html")
    public String grndcjzs(HttpServletRequest request, ModelMap model) {
        return "jump/grndcjzs";
    }

    /*
      * 个人年度成绩走势
     * */
    @RequestMapping(value="grndcjzs1.html")
    public String grndcjzs1(HttpServletRequest request, ModelMap model) {
        return "jump/grndcjzs1";
    }

    /*
     * 对比分析
    * */
    @RequestMapping(value="dbfx.html")
    public String dbfx(HttpServletRequest request, ModelMap model) {
        return "jump/dbfx";
    }

    /*
     * 我的考勤
    * */
    @RequestMapping(value="wdkq.html")
    public String wdkq(HttpServletRequest request, ModelMap model) {
        return "jump/wdkq";
    }
}


